Testing socialnetwork/get-global
Testing http://localhost:8000/socialnetwork/get-global
Internal Server Error: /socialnetwork/get-global
Traceback (most recent call last):
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/fields/__init__.py",
line 2018, in get_prep_value
return int(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'SimpleLazyObject'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File
"/usr/local/lib/python3.8/dist-packages/django/core/handlers/exception.py",
line 55, in inner
response = get_response(request)
File
"/usr/local/lib/python3.8/dist-packages/django/core/handlers/base.py",
line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/user/repo/hw6/socialnetwork/views.py", line 55, in get_json_stream
return get_json_stream_help(request, False)
File "/home/user/repo/hw6/socialnetwork/views.py", line 20, in get_json_stream_help
current_user = Profile.objects.get(user=request.user)
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/manager.py",
line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line 636, in get
clone = self._chain() if self.query.combinator else self.filter(*args, **kwargs)
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line
1420, in filter
return self._filter_or_exclude(False, args, kwargs)
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line
1438, in _filter_or_exclude
clone._filter_or_exclude_inplace(negate, args, kwargs)
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line
1445, in _filter_or_exclude_inplace
self._query.add_q(Q(*args, **kwargs))
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/sql/query.py",
line 1532, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/sql/query.py",
line 1562, in _add_q
child_clause, needed_inner = self.build_filter(
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/sql/query.py",
line 1478, in build_filter
condition = self.build_lookup(lookups, col, value)
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/sql/query.py",
line 1303, in build_lookup
lookup = lookup_class(lhs, rhs)
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/lookups.py",
line 27, in __init__
self.rhs = self.get_prep_lookup()
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/fields/related_lookups.py",
line 166, in get_prep_lookup
self.rhs = target_field.get_prep_value(self.rhs)
File
"/usr/local/lib/python3.8/dist-packages/django/db/models/fields/__init__.py",
line 2020, in get_prep_value
raise e.__class__(
TypeError: Field 'id' expected a number but got
<SimpleLazyObject: <django.contrib.auth.models.AnonymousUser
object at 0x7fda30582520>>.
[20/Oct/2022 18:37:50] "GET /socialnetwork/get-global HTTP/1.1" 500 120857
-5 points The server returned status_code=500 but should have returned 401